package teleware.soe.core.factory;

import teleware.soe.core.enums.MappingEnum;
import teleware.soe.core.strategy.MappingStrategy;

/**
 * 映射策略工厂
 *
 * @author :hongsw
 * @date :2020-12-11 16:20
 */
public class MappingStrategyFactory {
    /**
     * 获取映射策略具体实现
     *
     * @param strategy 映射类型
     * @return teleware.soe.core.strategy.MappingStrategy
     * @author hongsw
     * @date 2020/12/11 16:33
     **/
    public static MappingStrategy getMappingStrategy(MappingEnum strategy) {
        String strategyImplFullPathClassName = strategy.getStrategyImplFullPathClassName();
        try {
            return (MappingStrategy) Class.forName(strategyImplFullPathClassName).newInstance();
        } catch (Exception e) {
            return null;
        }
    }
}
